package com.lx.nba.parse.impl;

import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import com.lx.nba.parse.ContentContainer;
import com.lx.nba.util.Content;

public class DefaultContentContainer implements ContentContainer{

	private static int QUEUE_CAPACITY= 100 ;
	
	private BlockingQueue<Content> contents = new LinkedBlockingQueue(QUEUE_CAPACITY) ;
	
	@Override
	public void setContent(String content) {
		// TODO Auto-generated method stub
		try {
			
			contents.put(initContent(content)) ;
			
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	

	@Override
	public void setContent(Content content) {
		// TODO Auto-generated method stub
		try {
			
			contents.put(content) ;
			
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}



	@Override
	public Content getHeadContent() {
		// TODO Auto-generated method stub
		try {
			
			return contents.take();
			
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null ;
	}
	
	private Content initContent(String initContent ){
		
		Content content = new Content() ;
		
		
		return content ;
		
	}


}
